#include <stdio.h>

#define offsetof(type, member)   ((size_t)&(((type *)0)->member))

#define container_of(ptr, type, member) ({            \
         const typeof( ((type *)0)->member ) *__mptr = (ptr);     \
         (type *)( (char *)__mptr - offsetof(type,member) );})


#define cfg_read(s, d) ({ \
    const typeof(s) __tmp = s; \
    __tmp->d; \
})

#define cfg_write(s, d, val) ({ \
    typeof(s) __tmp = s; \
    __tmp->d = val; \
})
struct mystruct{
	int a;
	int b;
	char c;
	char d;
};

#define myarg(x) printf("%s = %d\n", ##x, #x)

int main(void) 
{
    struct mystruct s;
    cfg_write(&s, a, 1);
    cfg_write(&s, c, 3);
    //scfg_write(s, a, 1);
    int a = cfg_read(&s, c);
    printf("%d\n", a);
	printf("1, %ld\n", offsetof(struct mystruct, d));
	
	
}